#!/bin/bash


if [ -z `which cmake` ]; then  
    echo "---------------系统工具相关-------------------------"
    sudo apt install -y cloc tig cppman cmake cgdb ninja-build # hexcurse dhex 
    sudo apt install -y lsb-core lib32stdc++6 libssl-dev flex bison
    sudo apt-get install -y libglib2.0-dev libgtk-3-dev  # druid 
    sudo apt install -y gcc-multilib g++-multilib libelf-dev
    sudo apt install -y wireshark valgrind ssh cutecom
    # FPGA
    sudo apt install -y fxload libusb-dev libcanberra-gtk-module libcanberra-gtk3-module
fi

if [ -z `which rlwrap` ]; then 
    sudo apt-get install -y rlwrap
fi



if [ -z `which clang` ]; then 
	sudo apt install -y clang clangd clang-format
	sudo apt install -y bear
fi

uname -a | grep microsoft
# $? == 0, 表示是wsl
if [ $? == 1 ]; then
    if [ -z `which qtcreator` ]; then  
        sudo apt install -y qtbase5-dev qtcreator qt5-doc-html qtbase5-doc-html qtbase5-examples
        sudo apt install -y qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5
        sudo apt install -y qtdeclarative5-dev libqt5serialport5-dev
        sudo apt install -y qml-module-qtcharts libqt5charts5-dev
        sudo apt install -y qtquickcontrols2-5-dev
        sudo apt install -y qtquickcontrols5-examples qtquickcontrols2-5-examples

        # sudo apt install -y libxcb-cursor0
        # wget -P ~/Downloads/ https://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/online_installers/qt-unified-linux-x64-online.run
        # chmod +x ~/Downloads/qt-unified-linux-x64-online.run
        # 安装目录指定到 program/Qt
        # https://zhuanlan.zhihu.com/p/697911596
    fi


    # if [ -z `which intellij-idea-community` ]; then  
        # sudo add-apt-repository ppa:mmk2410/intellij-idea -y
        # sudo apt-get update
        # sudo apt install intellij-idea-community -y
    # fi
fi

sudo apt install -y openjdk-11-jdk
sudo apt install -y scala
sudo apt install -y verilator gtkwave
echo 'accel "/Time/Zoom/Zoom In" C
accel "/Time/Zoom/Zoom Out" O
accel "/Time/Zoom/Zoom Best Fit" F
accel "/Time/Zoom/Undo Zoom" Z 
accel "/File/Reload Waveform" <Control>R
fontname_signals fixed 14
fontname_waves terminus 14 ' > ~/.gtkwaverc

